package com.example.voucher.config.third;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ThirdAccountConfiguration {

    private static final Logger LOGGER = LoggerFactory.getLogger(ThirdAccountConfiguration.class);

    @Bean
    @ConditionalOnProperty(name = "current.setting.name", havingValue = "MIT")
    @ConfigurationProperties(prefix = "third-voucher-config-mit")
    public ThirdAccountBean mitThirdVoucherConfig() {
        ThirdAccountBean config = new ThirdAccountBean();
        return config;
    }
    
    @Bean
    @ConditionalOnProperty(name = "current.setting.name", havingValue = "TEST")
    @ConfigurationProperties(prefix = "third-voucher-config-test")
    public ThirdAccountBean testThirdVoucherConfig() {
        ThirdAccountBean config = new ThirdAccountBean();
        return config;
    }

    @Bean
    @ConditionalOnProperty(name = "current.setting.name", havingValue = "UAT")
    @ConfigurationProperties(prefix = "third-voucher-config-uat")
    public ThirdAccountBean uatThirdVoucherConfig() {
        ThirdAccountBean config = new ThirdAccountBean();
        return config;
    }

    @Bean
    @ConditionalOnProperty(name = "current.setting.name", havingValue = "PROD")
    @ConfigurationProperties(prefix = "third-voucher-config-prod")
    public ThirdAccountBean prodThirdVoucherConfig() {
        ThirdAccountBean config = new ThirdAccountBean();
        return config;
    }

}
